
__kernel void vec_add(__global const double *a, __global const double *b, __global double *c )
{
    size_t global_id = get_global_id(0);
    c[global_id] = a[global_id] + b[global_id];
}

kernel void vec_sum(global const double *a, global double *b)
{
    int id = get_global_id(0);
    double tmp = a[id];

    // b[0] = work_group_reduce_sum(tmp);
    b[1] = work_group_reduce_add(tmp);
    // barrier(CLK_LOCAL_MEM_FENCE);
    b[2] = work_group_reduce_min(tmp);
    
    b[3] = work_group_reduce_max(tmp);

}